//
//  IManager+ModuleChangeOrderCommit.m
//  RocketProject
//
//  Created by Wu Chengwei on 13-11-25.
//  Copyright (c) 2013年 Rocket. All rights reserved.
//

#import "IManager+ModuleChangeOrderCommit.h"
#import "FrameworkRelativeDefines.h"
#import "NetUrlDefines.h"
#import "RequestUtlity.h"
#import "NSString+NSString_Ex_.h"
#import "TravelException.h"
#import "GloableEngineService.h"
#import "RCFeedbackDataModel.h"

@implementation IManager(ModuleChangeOrderCommit)

-(int64_t)requestChangeCommitOrder:(NSString *)goodsID withName:(NSString *)name withContent:(NSString *)content withPhone:(NSString *)phone withChangeNum:(NSString *)num withDelegate:(id<IManagerDelegate>)delegate{
    if ([NSString stringIsNullOrEmpty:goodsID]) {
        return kInvalidRequestId;
    }
    if (nil == phone) {
        phone = @"";
    }
    if (nil == name) {
        name = @"";
    }
    if (nil == content) {
        content = @"";
    }

    if (nil == num) {
        num = @"";
    }

    NSMutableDictionary *postValue = [NSMutableDictionary dictionary];
    [postValue setObject:content forKey:@"message" withDefaultValue:@""];
    [postValue setObject:phone forKey:@"phone" withDefaultValue:@""];
    [postValue setObject:name forKey:@"name" withDefaultValue:@""];
    [postValue setObject:goodsID forKey:@"goodsid" withDefaultValue:@""];
    [postValue setObject:num forKey:@"num" withDefaultValue:@""];
    [postValue setObject:[GloableEngineService sharedInstance].bduss forKey:@"bduss" withDefaultValue:@""];
    // 异步获取数据
    NSString *urlSuffix = kRCChangeCommitOrderPrefix;
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    
    KFLog(@"request url %@",url);
    return [[IDataProvider sharedInstance] asyncPostData:url postValues:postValue postDataList:nil userInfo:nil withDataParseClass:[RCFeedbackDataModel class] withDataDelegate:delegate];
}

@end
